// 东莞专属功能
export default class {
  constructor(send2Ue, listen2Ue) {
    this.send2Ue = send2Ue;
    this.listen2Ue = listen2Ue;
    this.baseCmd = "/BuildingOperator";
  }
  active(data, cb) {
    this.send2Ue(
      `${this.baseCmd}/EnableBuildingOperator`,
      {
        BuildGUID: data,
      },
      cb
    );
  }
  cancel(cb) {
    this.send2Ue(`${this.baseCmd}/DisableBuildingOperator`, {}, cb);
  }
  highlightByName(name, type='', cb) {
    this.send2Ue(
      `${this.baseCmd}/HighLightFloorContentByTag`,
      {
        TagName: name,
        TypeName: type,
      },
      cb
    );
  }
  highlightByMetadata(data, cb) {
    let key = "";
    let value = "";
    if (data instanceof Object) {
      key = Object.keys(data)[0];
      value = Object.values(data)[0];
    }

    this.send2Ue(
      `${this.baseCmd}/HighLightFloorContentByMetaData`,
      {
        MetaKey: key,
        MetaValue: value,
      },
      cb
    );
  }
  cancelHighlight(cb) {
    this.send2Ue(`${this.baseCmd}/UnHighLightFloorContent`, {}, cb);
  }
  setActorVisible(name, visible, cb) {
    this.send2Ue(
      `${this.baseCmd}/SetFloorContentVisible`,
      {
        TypeName: name,
        Status: visible,
      },
      cb
    );
  }
  viewByFloor(floor, cb) {
    this.send2Ue(
      `${this.baseCmd}/ObserveFloor`,
      {
        FloorID: parseInt(floor),
      },
      cb
    );
  }
  restoreBuild(cb) {
    this.send2Ue(`${this.baseCmd}/ReAllBuilding`, {}, cb);
  }
}
